Post

Replies

Boosts

Views

Activity

Reply to TaskGroup Crash
I'm also seeing this issue on the same OS versions and devices. I think the bug may be that TaskGroups aren't properly inheriting the execution context of their parent tasks. For example, in: Task { @MainActor in   await withTaskGroup(of: Void.self) { taskGroup in     taskGroup.addTask {       foo()     }     bar()   } } I'd expect foo() and bar() to run on @MainActor since the task is run there, but it seems that on these specific OS versions that's not always the case.
Jan ’23
Reply to Using @FocusedBinding with a Class to update a CommandMenu
I think what Apple would tell you to do would be to use the class-based Model like you gave in your example and rather than passing the model to your AppCommands, you would pass the playing property directly like: .focusedValue(\.playing, $model.playing) and your binding would become @FocusedBinding(\.playing) var playing: Bool?. That being said, I think this solution is less than ideal and Apple should add a FocusedObject or similar property. Having to pass these properties directly involves a lot of code duplication and reduces functionality. Your example is straightforward, but in a more complex case Model may wish to react to, intercept, or otherwise want to capture the value change directly and doing it this way makes that much harder.
Jan ’22